<!DOCTYPE html>
<html lang="en">

<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Document</title>
</head>

<body>
  <script>
    // 需求：求兔子序列  1 1 2 3 5 8 13 21.......
    // 推导公式：fib(m) = fib(m-1) + fib(m-2)

    function fib(n) {
      if (n <= 2) {
        return 1
      }
      return fib(n - 2) + fib(n - 1)
    }

    console.log(fib(5));
  </script>
</body>

</html>